package org.effdom.io;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

import org.effdom.util.Hex;
import org.junit.Test;

public class CompressTester {

    @Test
    public void testCompress() throws Exception {
        ByteArrayOutputStream arrayOut = new ByteArrayOutputStream();
        arrayOut.write(1);
        GZIPOutputStream zipOut = new GZIPOutputStream(arrayOut);
        DataOutputStream out = new DataOutputStream(zipOut);
        out.write(2);
        out.flush();
        out.close();
        System.out.println(Hex.toHex(arrayOut.toByteArray()));
        ByteArrayInputStream in = new ByteArrayInputStream(arrayOut.toByteArray());
        in.read();
        GZIPInputStream zipIn = new GZIPInputStream(in);
        DataInputStream inn = new DataInputStream(zipIn);
        inn.read();
    }
}
